
S = sprandn(50,50,0.5);
G = full(S);

pw=java.io.PrintWriter(java.io.FileWriter('c:\\matrix\matrix.txt'));
%%line=num2str(0:size(G,2)-1);
%%pw.println(line);

for index=1:length(G)
    %%disp(index);
    line=num2str(full(G(index,:)));
    pw.println(line);
end
pw.flush();
pw.close();

S = randn(2000000,1,1);
G = full(S);

pw=java.io.PrintWriter(java.io.FileWriter('c:\\matrix\vector.txt'));
%%line=num2str(0:size(G,2)-1);
%%pw.println(line);

pw.print('2000000');
pw.print(' ');
pw.print('1');
pw.print(' ');
pw.print('2000000');
pw.println(' ');
for index=1:length(G)
    %%disp(index);
    line2 = int32(index);
    
    line=num2str(full(G(index,:)));
    pw.print(floor(line2));
    pw.print(' 1 ');

    pw.println(line);
    
end
pw.flush();
pw.close();